jQuery.fn.colspan = function(rowIdx) {
	return this.each( function() {
		var that;
		$('tr', this).filter(":eq(" + rowIdx + ")").each( function(row) {
			$(this).find('td').filter(':visible').each( function(col) {

				if (that != null && $(this).html() == $(that).html()) {
					colspan = $(that).attr("colSpan");
					if (colspan == undefined) {
						$(that).attr("colSpan", 1);
						colspan = $(that).attr("colSpan");
					}
					colspan = Number(colspan) + 1;
					$(that).attr("colSpan", colspan);
					$(this).hide(); // .remove();
				} else {
					that = this;
				}
				//that = (that == null) ? this : that; // set the that if not already set
			});
		});
	});
}